﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LSP.BAD
{
    class BetweenValidator<T> : MinValueValidator<T>
        where T:IComparable
    {

        public T MaxValue { get; set; }
        public BetweenValidator(T minValue, T maxValue)
            :base(minValue)
        {
            MaxValue=maxValue;
        }


        public override bool IsValid(T value)
        {
            bool retVal = base.IsValid(value);
            if (retVal)
            {
                retVal = value.CompareTo(MaxValue) < 0;
            }
            return retVal;
        }
    }
}
